home *** CD-ROM | disk | FTP | other *** search
- GEOPAINT FILE FORMAT
-
- Cards and color on the c64 (background).
- The graphics mode used by GEOS on the c64 supports 320 by
- 200 resolution, organized as a 40 by 25 matrix of 8 by 8
- pixel cards. These cards are stored in the frame buffer
- from left to right, top to bottom. The diagram below
- better illustrates this format.
-
- ON SCREEN:
- card0 card1 card2 ... card39
- card40 card41 card42 ... card79
- .
- .
- card960 card961 card962 ... card999
-
- EACH CARD: byte0
- byte1
- ...
- byte6
- byte7
- Each byte contains 8 bits, 1 per pixel on the screen.
- These eight bytes make up an 8 by 8 pixel image.
-
- IN FRAME BUFFER:
- CARD0 CARD1 CARD2
- CARD ROW 0 -> byte0 byte8 byte 16
- ... ... ...
- byte7 byte15 byte23
-
- CARD40 CARD41 CARD42
- CARD ROW 1 -> byte320 byte328 byte336
- ... ... ...
- byte327 byte335 byte443
-
- This graphics mode supports 16 colors, but the color
- resolution is limited to card boundaries. That is, two
- colors can be specified for each card on the screen -- a
- background color (bits set to 0 in the card) and a
- foreground color (bits set to 1 in the card). This color
- information is stored separately from the frame buffer,
- one byte per card. The high 4 bits in the byte specify
- one of 16 colors to be used for the foreground, and the
- low four bits specify the background color.
- GEOPAINT FILE FORMAT
- -------- ---- ------
- A geoPaint data file is a VLIR file with 45 records.
- (For info on what a VLIR file is, see the GEOS Programmer's
- Reference Manual). Each record holds the image and color
- data for an area of the page 16 lines high by 640 pixels
- wide. A geoPaint document is 720 lines high by 640 pixels
- wide, so each record represents two card rows of the
- entire document. The image data is stored in the same
- card format used by the 320 by 200 graphics mode on the
- c64, discussed above.
- When a geoPaint file is created, all 45 records are
- marked as used in the index table of the VLIR file. The
- track and sector pointers are set to $00,$FF to indicate
- an empty record; instead of $00,$00 which indicates an
- unused record.
- The 45 records are assigned to alternate card rows,
- from top to bottom on the document. That is, record 0
- contains the image and color data for card rows 0 and 1;
- record 1 for card rows 2 and 3, etc.
- The image and color info is compacted before being
- written to the record. The pre-compacted layout of the
- data is:
-
- #bytes start/end ($) description
- ------ ------------- -----------
- 640 000 - 27F image data for
- 1st card row
-
- 640 280 - 4FF image data for
- 2nd card row
-
- 8 500 - 507 all zeroes.
-
- 80 508 - 557 color info for
- first card row
-
- 80 558 - 5A7 color info for
- 2nd card row
-
- The eight bytes of zero were included in geoPaint 1.0
- files through an oversight, and retained after that for
- compatability.
- COMPACTION FORMAT
- ---------- ------
- The compaction routine operates on the entire 1448
- bytes at once, resulting in a string of bytes in the
- following format.
-
- ---------------------
- ! command/count ! data !
- ! byte ! byte !
- --------------------- ......
-
- Where there is one command/count byte, and from 1 to
- 63 data bytes. This pattern is repeated until all 1448
- bytes are represented. The command/count byte is
- interpreted as follows:
-
- hex value interpretation
- --------- --------------
- $00 End of record
-
- $01 - $3F Use command byte as COUNT.
- The following COUNT data
- bytes are uncompacted.
-
- $40 Invalid command byte.
-
- $41 - $7F Subtract $40 from the
- command byte, use the
- result as COUNT. The next
- 8 data bytes comprise a
- card to repeat COUNT times.
- These 8 data bytes expand
- to 8*COUNT image bytes.
-
- $80 Invalid command byte.
-
- $81 - $FF Subtract $80 from the
- command byte, use the
- result as COUNT. Repeat the
- single data byte that
- follows COUNT times. This
- single byte expands to
- COUNT image bytes.